package com.wm.proxy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: Proxy
 * @Description: 公司代理
 * @Author: WM
 * @Date: 2023/5/4 15:30
 */
public class Proxy implements Company {

    private final static Logger logger = LoggerFactory.getLogger(Proxy.class);
    private HR hr;

    public Proxy() {
        super();
        this.hr = new HR();
    }

    @Override
    public void findWorker(String title) {
        // 需要代理的方法
        hr.findWorker(title);
        // 通过猎头找候选人
        String worker = getWorker(title);
        logger.info("find a worker by proxy, worker name is :" + worker);
    }

    private String getWorker(String title) {
        Map<String, String> workerList = new HashMap<String, String>() {
            {
                put("Java", "张三");
                put("Python", "李四");
                put("Php", "王五");
            }
        };
        return workerList.get(title);
    }
}
